package com.snowy.hidden.constant;

import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 *故障设备
 * </p>
 *
 * @author：Lei.y
 * @date：2022/5/11 15:42
 */
@Getter
public enum FaultRangeEnum {
    zn("1","站内"),
    zw("2","站外"),
    ;

    private String code;
    private String desc;

    FaultRangeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 通过code获取枚举
     *
     * @param code
     * @return
     */
    public static FaultRangeEnum getEnum(String code) {
        return Arrays.stream(FaultRangeEnum.values()).filter(item -> item.getCode().equals(code)).findFirst().get();
    }
}
